import got from "got";
import { readFileByType } from "./util";

const prefixUrl = process.env.ICAN_PREFIXURL;
const delThoughtsUrl = process.env.ICAN_DEL_THOUGHTS;
const token = readFileByType('access_token')


const delThoughts = async (ids: number[]) => {
  const headers = {
    authorization: `Bearer ${token}`
  }
  const postUrl = `${prefixUrl}${delThoughtsUrl}`;
  try {
    const res = await got.post(postUrl, {
      method: "POST",
      headers,
      json: ids
    });
    console.log(`删除${ids}成功`);
    return res;
  } catch (error) {
    console.error(error);
  }
}

export { delThoughts }